package yang.itcode.controller;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import yang.itcode.model.Result;
import yang.itcode.service.SystemService;

@RestController
@RequestMapping("/api/system")
public class SystemController {
    @Autowired
    private SystemService systemService;

    @GetMapping("/store-status")
    public Result<JSONObject> getStoreStatus() {
        return Result.success(systemService.getStoreStatus());
    }

    @GetMapping("/today-business")
    public Result<JSONObject> getTodayBusiness() {
        return Result.success(systemService.getTodayBusiness());
    }

    @GetMapping("/inventory-warning")
    public Result<JSONArray> getInventoryWarning() {
        return Result.success(systemService.getInventoryWarning());
    }
}
